//package cur.nature.mybatis.common.config;
//
//
//import cur.nature.tinyorm.core.template.DefaultJdbcTemplate;
//import com.zaxxer.hikari.HikariDataSource;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.jdbc.core.JdbcTemplate;
////import org.springframework.cloud.context.config.annotation.RefreshScope;
//
//@Configuration
////@MapperScan(basePackages = {
////        "mybatis.quant.mapper",
//////        "com.cur.main.base.mapper",
//////        "com.cur.main.platform.*.mapper"
////}, sqlSessionTemplateRef  = "curAdminSessionTemplate")
////@ConditionalOnProperty( value = {"cur.admin.manager.enable"})
//public class CurSystemDBConfig {
////	static final String MAPPER_LOCATIONS = "classpath*:net/hkt/xml/*.xml,classpath:mapper_hkt/*.xml";
//	static final String MAPPER_LOCATIONS = "classpath*:mybatis/quant/mapper/*.xml";
//
////    @RefreshScope
//	@Bean(name = DefaultJdbcTemplate.DATASOURCE)
//    @ConfigurationProperties(prefix = "spring.datasource.hikari")
////    @QuartzDataSource
//    public HikariDataSource curDefaultDatasource() {
//        HikariDataSource dataSource = new HikariDataSource();
////        dataSource.setJdbcUrl("jdbc:mysql://dev.local.com:3306/xxx?useSSL=true&verifyServerCertificate=false&autoReconnect=true");
////        dataSource.setUsername("xxx");
////        dataSource.setPassword("xxxx");
////        // 其他配置...
////        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
////        dataSource.setMinimumIdle(30);
////        dataSource.setMaximumPoolSize(100);
////        dataSource.setAutoCommit(true);
////        dataSource.setIdleTimeout(30000);
////        dataSource.setMaxLifetime(1800000);
////        dataSource.setConnectionTimeout(30000);
////        dataSource.setConnectionTestQuery("SELECT 1");
////        dataSource.setValidationTimeout(10000);
//
//        return dataSource;
//    }
//
////    @Bean(name = "curAdminSessionFactory")
////    public SqlSessionFactory curAdminSessionFactory(@Qualifier("curAdminDataSource") DataSource dataSource) throws Exception {
////        LOG.info("开始初始化数据连接池。。。。。。。");
////    	final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
////        sessionFactory.setDataSource(dataSource);
////        sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MAPPER_LOCATIONS));
//////        String[] locations = MAPPER_LOCATIONS.split(",");
//////        PathMatchingResourcePatternResolver matches = new PathMatchingResourcePatternResolver();
//////        Resource[] res = matches.getResources(locations[0].trim());
//////        Resource[] res2 = matches.getResources(locations[1].trim());
//////        sessionFactory.setMapperLocations((Resource[])ArrayUtils.addAll(res, res2));
//////        return sessionFactory.getObject();
////
////        // 分页插件
//////        PageHelper pageHelper = new PageHelper();
//////        Properties props = new Properties();
//////        props.setProperty("reasonable", "true");
//////        props.setProperty("supportMethodsArguments", "true");
//////        props.setProperty("returnPageInfo", "check");
//////        props.setProperty("params", "count=countSql");
//////        pageHelper.setProperties(props);
//////        // 添加插件
//////        sessionFactory.setPlugins(new Interceptor[] { pageHelper });
////        //设置类型转换器
//////        sessionFactory.setTypeHandlers();
////        LOG.info("结束初始化数据连接池。。。。。。。");
////        return sessionFactory.getObject();
////    }
////
////    @Bean(name = "curAdminTransactionManager")
////    public DataSourceTransactionManager curAdminTransactionManager(@Qualifier("curAdminDataSource") DataSource dataSource) {
////        return new DataSourceTransactionManager(dataSource);
////    }
////
////    @Bean(name = "curAdminSessionTemplate")
////    public SqlSessionTemplate curAdminSessionTemplate(@Qualifier("curAdminSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
////        return new SqlSessionTemplate(sqlSessionFactory);
////    }
//
//    @Bean(name = DefaultJdbcTemplate.TEMPLATE)
//    public JdbcTemplate curDefaultTemplate() {
//        return new DefaultJdbcTemplate(curDefaultDatasource());
//    }
//
//}